//
//  ViewController.swift
//  Skeleton
//
//  Created by bin hu on 2025/6/4.
//

import UIKit

class ViewController: UIViewController {
    
    @IBOutlet weak var stv: UIStackView!
    @IBOutlet weak var contentView: UIView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
//        contentView.skeletonEnable = true
        
        viewAnimations()
    }
    
    @IBAction func buttonClick(_ sender: UIButton) {
        viewAnimations()
    }
    
    func viewAnimations() {
        contentView.skeletonEnable = true
        stv.skeletonEnable = true
        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()+3.0) {
            self.contentView.skeletonEnable = false
            self.stv.skeletonEnable = false
        }
    }
    
    
    @IBAction func animationButtonClick(_ sender: UIButton) {
        
        switch sender.tag {
        case 881,882:
            let pd = ProductViewController()
            pd.index = sender.tag - 880
            self.present(pd, animated: true)
        default:
            let pd = ExampleViewController()
            self.present(pd, animated: true)
        }
        
    }
    
    
}

